#!/usr/bin/env perl

use strict;
use warnings;

$| = 1;

use constant LEFT_FIELD_NTH => 0;

my $dump_file = $ARGV[0];
my $urls_file = $ARGV[1];
die "\tUsage: $0 <dump_file> <urls-file>\n" unless $dump_file and $urls_file; 

my	%urls = ();

open(FH_URLS, $urls_file) or die "fail to open $urls_file : $!\n";
while (<FH_URLS>) {
	chomp;
	next unless $_;
	$urls{$_} = 1;
}
close(FH_URLS);

open(FH_DUMP, $dump_file) or die "fail to open $dump_file : $!\n";

while (<FH_DUMP>) {
	chomp;
	my @f = split;
	my	$url = $f[ LEFT_FIELD_NTH ];
	next unless $url;

	print "$_\n" if exists $urls{$url};
}

close(FH_DUMP);

